package com.zz.dynamicplan;

public class L509Solution {
    public int fib(int n) {
        int one=1, two=1, three=0;
        if(n==1){
            return 1;
        }else if(n==2){
            return 1;
        }else{
            for(int i=3; i<=n; i++){
                three = one + two;
                one = two;
                two = three;
            }
            return three;
        }
    }
}
